package com.finger.forest.adapter;

import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.finger.forest.AlarmCheckActivity;
import com.finger.forest.AlarmListActivity;
import com.finger.forest.HotCheckActivity;
import com.finger.forest.HotListActivity;
import com.finger.forest.R;
import com.finger.forest.model.AlarmCheckModel;
import com.finger.forest.model.FzFireModel;
import com.finger.forest.model.FzHotspot;

import java.util.List;

/**
 * 火情核查Adapter
 */
public class AlarmCheckListAdapter extends BaseQuickAdapter<FzFireModel, BaseViewHolder> {

    private Context context;
    private int type;

    public AlarmCheckListAdapter(int layoutResId, @Nullable List<FzFireModel> data, Context context, int type) {
        super(layoutResId, data);
        this.context = context;
        this.type = type;
    }

    @Override
    protected void convert(BaseViewHolder helper, FzFireModel item) {

        TextView hotName = (TextView) helper.getView(R.id.tv_hot_name);
        TextView hotCodeName = (TextView) helper.getView(R.id.tv_hot_code);
        TextView hotAddressName = (TextView) helper.getView(R.id.tv_hot_address);
        Button detailBtn = (Button) helper.getView(R.id.detailBtn);

        hotName.setText(item.getFiReporter());
        hotCodeName.setText(item.getFiPhoneNumber());
        hotAddressName.setText(item.getFiPosition());
        detailBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intentAlarmCheck = new Intent(context, AlarmCheckActivity.class);
                intentAlarmCheck.putExtra("id", item.getFiId().toString());//报警ID
                intentAlarmCheck.putExtra("type", type);//反馈类型
                ((AlarmListActivity)context).startActivityForResult(intentAlarmCheck,1);
            }
        });

    }
}
